local shiren = fk.CreateSkill{
    name = "jin_heg__shiren",
}

Fk:loadTranslationTable{
    ["jin_heg__shiren"] = "识人",
    [":jin_heg__shiren"] = "每回合限一次，未确定势力的其他角色受到伤害后，你可以交给其两张牌并摸两张牌。",

    ["#jin_heg__shiren-invoke"] = "识人：你可交给 %dest 两张牌，然后你摸两张牌",

    ["$jin_heg__shiren1"] = "宠过必乱，不可大任。",
    ["$jin_heg__shiren2"] = "开卷有益，识人有法。",
}

local H = require "packages.ol_hegemony.util"

shiren:addEffect(fk.Damaged,{
    can_trigger = function (self, event, target, player, data)
        return player:hasSkill(shiren.name) and H.getGeneralsRevealedNum(target) == 0 and player ~= target and #player:getCardIds("he") >= 2
        and player:usedSkillTimes(shiren.name, Player.HistoryTurn) == 0
      end,
      on_cost = function(self, event, target, player, data)
        local cards = player.room:askToCards(player,{
            min_num = 2,
            max_num = 2,
            include_equip = true,
            skill_name = shiren.name,
            prompt = "#jin_heg__shiren-invoke::"..target.id,
            cancelable = true,
        })
        if #cards > 0 then
          event:setCostData(self, {cards = cards})
          return true
        end
      end,
      on_use = function (self, event, target, player, data)
        local room = player.room
        room:obtainCard(target, event:getCostData(self).cards, false, fk.ReasonGive, player.id, shiren.name)
        if not player.dead then
          player:drawCards(2, shiren.name)
        end
      end,
})

return shiren